<?php if($userEmails):?>
    <ul class="list-group">
        <?php foreach($userEmails as $email):?>
            <li class="list-group-item">
                <?php if(count($userEmails) > 1):?> 
                    <span class="email_radio">
                        <input id="email_id_<?php echo $email->id?>" email_value="<?php echo $email->email?>" title="Đặt làm email chính" type="radio" name="is_main" value="<?php echo $email->id?>" <?php if($email->is_main):?>checked="checked"<?php endif?>>
                    </span>
                <?php endif?>
                
                <span class="email">
                    <label for="email_id_<?php echo $email->id?>"><?php echo $email->email?></label>
                </span>
                
                <?php if($email->openid_service):?>
                    <span class="email_openid" title="<?php echo $email->openIdServiceLabel?> Openid">
                        <i class="<?php echo $email->openidIconClass?>"></i>
                    </span>
                <?php endif?>

                <?php if(count($userEmails) > 1):?> 
                    <?php if($email->is_main):?>
                        <span class="email_main label label-success">
                            <i class="fa fa-envelope-o"></i> <?php if($email->is_main):?>Email chính<?php endif?>
                        </span>
                        <?php else:?>
                            <button class="btn label label-danger email_remove" email_id="<?php echo $email->id?>" email="<?php echo $email->email?>" title="Xóa email <?php echo $email->email?>"><i class="fa fa-times"></i> Xóa</button>
                        <?php endif?>
                    <?php endif?>
            </li>
            <?php endforeach?>
    </ul>

<?php else:?>
    <div>Tài khoản của bạn chưa có email nào</div>
<?php endif?>
